using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using ns20;

namespace ns16
{
	internal class Class91 : IReferenceResolver
	{
		private int int_0;

		private Class180<string, object> method_0(object object_0)
		{
			Class136 @class;
			if (object_0 is Class136)
			{
				@class = (Class136)object_0;
			}
			else
			{
				if (!(object_0 is Class113))
				{
					throw new JsonException("The DefaultReferenceResolver can only be used internally.");
				}
				@class = ((Class113)object_0).method_4();
			}
			return @class.Class180_0;
		}

		public object ResolveReference(object context, string reference)
		{
			method_0(context).method_1(reference, out var gparam_);
			return gparam_;
		}

		public string GetReference(object context, object value)
		{
			Class180<string, object> @class = method_0(context);
			if (!@class.method_2(value, out var gparam_))
			{
				int_0++;
				gparam_ = int_0.ToString(CultureInfo.InvariantCulture);
				@class.method_0(gparam_, value);
			}
			return gparam_;
		}

		public void AddReference(object context, string reference, object value)
		{
			method_0(context).method_0(reference, value);
		}

		public bool IsReferenced(object context, object value)
		{
			string gparam_;
			return method_0(context).method_2(value, out gparam_);
		}
	}
}
